
// 返回首页的逻辑
import cancelCode from '../request/cancelCode';
export default function() {
    // 清空数据
    const {
        addPageTemplate,
        cardTable,
        form
    } = this.props;
    if(this.props.pageFrom === 'add') {
        let staffCode = form.getFormItemsValue('bd_psndoc', 'code').value || '';
        let staffNumber = form.getFormItemsValue('hi_psnjob_h', 'clerkcode').value || '';
        cancelCode({
            psndoc_clerk_code: staffNumber,
            psndoc_code: staffCode
        });
    }
    let ctrtData = cardTable.getAllRows('hi_psndoc_ctrt');
    this.props.ctrtCodesRollBack(ctrtData)
    addPageTemplate.areaCodeList.map((item) => {
        cardTable.setTableData(item, {rows: []}, null, false);
    });
    this.props.updateState({
        pk_psnjob: '',
        contartNewCodeList: []
    })
    // 返回首页
    this.props.goBackToMainPage();
}
